home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / nvlexp / map_drv.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-12-05  |  3.9 KB  |  128 lines

  1. VERSION 2.00
  2. Begin Form Map_Drv 
  3.    Caption         =   "Map Drives"
  4.    ClientHeight    =   4335
  5.    ClientLeft      =   105
  6.    ClientTop       =   390
  7.    ClientWidth     =   8235
  8.    Height          =   4740
  9.    Left            =   45
  10.    LinkMode        =   1  'Source
  11.    LinkTopic       =   "Form1"
  12.    ScaleHeight     =   4335
  13.    ScaleWidth      =   8235
  14.    Top             =   45
  15.    Width           =   8355
  16.    Begin TextBox Hidden2 
  17.       Height          =   285
  18.       Left            =   6960
  19.       TabIndex        =   4
  20.       Text            =   "Hidden2"
  21.       Top             =   3750
  22.       Visible         =   0   'False
  23.       Width           =   885
  24.    End
  25.    Begin CommandButton Command2 
  26.       Caption         =   "Quit"
  27.       Height          =   495
  28.       Left            =   3300
  29.       TabIndex        =   2
  30.       Top             =   3690
  31.       Width           =   915
  32.    End
  33.    Begin CommandButton Command1 
  34.       Caption         =   "Map Un-mapped Drive"
  35.       Height          =   495
  36.       Left            =   270
  37.       TabIndex        =   1
  38.       Top             =   3690
  39.       Width           =   2145
  40.    End
  41.    Begin TextBox Hidden1 
  42.       Height          =   285
  43.       Left            =   6960
  44.       TabIndex        =   3
  45.       Text            =   "Hidden1"
  46.       Top             =   3480
  47.       Visible         =   0   'False
  48.       Width           =   885
  49.    End
  50.    Begin ListBox List1 
  51.       FontBold        =   -1  'True
  52.       FontItalic      =   0   'False
  53.       FontName        =   "Courier"
  54.       FontSize        =   9.75
  55.       FontStrikethru  =   0   'False
  56.       FontUnderline   =   0   'False
  57.       Height          =   2955
  58.       Left            =   270
  59.       TabIndex        =   0
  60.       Top             =   480
  61.       Width           =   7575
  62.    End
  63. DefInt A-Z
  64. Sub Command1_Click ()
  65. '   Map un-mapped drives
  66.     PathFrm.Show 1
  67.     If Abort% = False Then          'go ahead & do it
  68.         DLetter$ = Hidden1.Text
  69.         DPath$ = Hidden2.Text
  70.         CServer$ = MainForm.Text1.Text
  71.         MDrive DLetter$, DPath$, CServer$
  72.         ClearListBox List1
  73.         FillForm
  74.     End If
  75. End Sub
  76. Sub Command2_Click ()
  77.     Unload Map_Drv
  78. End Sub
  79. Sub FillForm ()
  80. '   ===================================================================
  81. '   Note: This sub depends upon having a global array called ArrayUnMap
  82. '   ===================================================================
  83.     ReDim ArrayLocal(26) As Integer
  84.     ReDim ArrayHandle(26) As Integer
  85.     ReDim ArrayConnect(26) As Integer
  86.     ReDim ArrayUnMap$(26)   ' ArrayUnMap$() is Global
  87.     For i% = 0 To 25
  88.         Res% = GetDriveInformation(i%, ConnectionID%, DirectoryHandle%)
  89.         If Res% = 128 Then
  90.             ArrayLocal(i%) = True
  91.         Else
  92.             ArrayLocal(i%) = False
  93.         End If
  94.         ArrayHandle(i%) = DirectoryHandle%
  95.         ArrayConnect(i%) = ConnectionID%
  96.     Next i%
  97.     j% = 1
  98.     For i% = 0 To 25
  99.         Tmp0$ = Chr$(65 + i%) + ":   "
  100.         If ArrayLocal(i%) = True Then
  101.             Tmp1$ = "Local Drive:     "
  102.         Else
  103.             Tmp1$ = "Network Drive: "
  104.         End If
  105.         If ArrayConnect(i%) = 0 And ArrayLocal(i%) <> True Then
  106.             ArrayUnMap$(j%) = Tmp0$
  107.             j% = j% + 1
  108.             Tmp2$ = "-- no mapping --"
  109.             Tmp3$ = ""
  110.         ElseIf ArrayLocal(i%) = True Then
  111.             Tmp2$ = "N/A"
  112.             Tmp3$ = ""
  113.         Else
  114.             Tmp2$ = Space$(255)
  115.             Ret% = GetDirectoryPath(ArrayHandle(i%), Tmp2$)
  116.             
  117.             FSN$ = Space$(48)
  118.             GetFileServerName ArrayConnect(i%), FSN$
  119.             Tmp3$ = AllTrim(FSN$) + ": "
  120.         End If
  121.         TmpStr$ = Tmp0$ + Tmp1$ + Space$(3) + Tmp3$ + Tmp2$
  122.         Map_Drv.List1.AddItem TmpStr$
  123.     Next i%
  124. End Sub
  125. Sub Form_Load ()
  126.     FillForm
  127. End Sub
  128.